{% extends 'base.html' %}
{% block content %}
<div class="container mt-3">
  <div class="d-flex justify-content-between align-items-center">
    <h3>许可详情</h3>
    <div>
      <a class="btn btn-sm btn-primary" href="{% url 'assets:license_update' license.id %}">编辑</a>
      <a class="btn btn-sm btn-secondary" href="{% url 'assets:license_list' %}">返回列表</a>
    </div>
  </div>
  <dl class="row mt-3">
    <dt class="col-sm-2">软件</dt><dd class="col-sm-10"><a href="{% url 'assets:software_detail' license.software.id %}">{{ license.software.name }}</a></dd>
    <dt class="col-sm-2">许可密钥</dt><dd class="col-sm-10">{{ license.license_key|default:'(无)' }}</dd>
    <dt class="col-sm-2">数量</dt><dd class="col-sm-10">{{ license.seats }}</dd>
    <dt class="col-sm-2">有效期</dt><dd class="col-sm-10">{{ license.start_date }} ~ {{ license.end_date }}</dd>
    <dt class="col-sm-2">状态</dt><dd class="col-sm-10">{{ license.get_status_display }}</dd>
    <dt class="col-sm-2">供应商</dt><dd class="col-sm-10">{{ license.supplier }}</dd>
    <dt class="col-sm-2">备注</dt><dd class="col-sm-10">{{ license.notes|linebreaks }}</dd>
  </dl>

  <form method="post" action="{% url 'assets:license_delete' license.id %}" onsubmit="return confirm('确认删除该许可？');">
    {% csrf_token %}
    <button type="submit" class="btn btn-danger">删除许可</button>
  </form>
</div>
{% endblock %}
